import {
    DIC
  } from '@/const/dic'
  export const option = {
    index:true,
    indexLabel:'序号',
    border: true,
    selection: false,
    menuBtn: true,
    addBtn: false,
    cellBtn: false,
    editBtn: false,
    delBtn: false,
    dicData: DIC,
    columnBtn: false,
    refreshBtn:false,
    size: 'mini',
    align: "center",
    menuWidth: 280,
    menuAlign: "center",
    column: [{
        label: "审批单号",
        prop: "approvalNumber",
        width: '150'
    },{
        label: "审批状态",
        prop: "approvalStatus",
        slot: true,
    },{
        label: "报废类型",
        prop: "scrapType",
        slot: true,
    },{
        label: "设备类别",
        prop: "equipmentTypeName",
        slot: true,
    },{
        label: "设备编码",
        prop: "coded",
        slot: true,
    },{
        label: "设备名称",
        prop: "equipmentName",
        slot: true,
    },{
        label: "型号",
        prop: "marking",
        slot: true,
    },{
        label: "品牌",
        prop: "brand",
        slot: true,
    },{
        label: "预约部门/人",
        prop: "applyuser",
        width: 150,
        slot: true,
    },{
        label: "申请时间",
        prop: "applicationTime",
        width: 150,
    },
    ]
  };
  export function jsonToArray(nodes) {
      var r=[];
      if (Array.isArray(nodes)) {
        for (var i=0, l=nodes.length; i<l; i++) {
          r.push(nodes[i]); // 取每项数据放入一个新数组
          if (Array.isArray(nodes[i]["children"])&&nodes[i]["children"].length>0)
           // 若存在children则递归调用，把数据拼接到新数组中，并且删除该children
            r = r.concat(jsonToArray(nodes[i]["children"]));
              delete nodes[i]["children"]
        }
      } 
      return r;
  }
  
  